<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/9/17
 * Time: 15:43
 */

namespace app\zucai\admin;
use app\admin\controller\Admin;
use app\common\builder\ZBuilder;
use think\Db;


class Caizhong extends Admin
{
    public function index()
    {

        // 获取排序
        $order = $this->getOrder();

        // 获取筛选
        $map = $this->getMap();

        //if (!$order) $order='create_time desc';

        $caizhong=Db::name('caizhong')->where($map)->order($order)->select();
        return ZBuilder::make('table')
            ->hideCheckbox()
            ->setTableName('caizhong')
//            ->addFilter('create_time,update_time') // 添加筛选
//            ->addOrder('update_time,create_time') // 添加排序
//            ->addTimeFilter('update_time')
            ->addColumns([
                ['__INDEX__', '序号'],
                ['name', '彩种名称'],
                ['logo', '彩种logo','picture'],
                ['content', '彩种介绍'],
                ['biaoshi', '彩种标识'],
                ['status', '状态','switch'],
            ])
            ->setRowList($caizhong)
            ->fetch();
    }
}